#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "st.h"

static int errfd        = STDERR_FILENO;
extern void err_sys_quit(int fd, const char *fmt, ...);


void *my_thread_func(void *arg)
{
    int i;
    for (i = 0; i < 5; i++)
    {
        printf("In thread: %d\n", i);
        st_sleep(1);
    }

    return NULL;
}

int main(void)
{
    int i;

  if (st_init() < 0)
        printf("st_init error");


    st_thread_t thread = st_thread_create(my_thread_func, NULL, 0, 0);
    for (i = 0; i < 5; i++)
    {
        printf("In main: %d\n", i);
        st_sleep(1);
    }

    st_thread_join(thread, NULL);
    return 0;
}
